# Maintainer: Ivan Semkin (ivan at semkin dot ru)

pkgname=unity8-git
_pkgname=unity8
pkgver=r17991.18c3f6f3c
pkgrel=2
pkgdesc='Unity 8 shell'
url='https://github.com/ubports/unity8'
arch=(x86_64 i686 armv7h aarch64)
license=(LGPL3)
conflicts=(unity8)
provides=(unity8)
depends=(lcov gcovr geonames-git unity-api-git qmenumodel-git gnome-desktop ubuntu-app-launch-git ubuntu-ui-toolkit-git libqtdbustest-git libqtdbusmock-git system-settings-git indicator-network-git libusermetrics-git liblightdm-qt5 settings-components-git unity7-schemas gsettings-ubuntu-touch-schemas-git ubuntu-wallpapers)
makedepends=(git cmake cmake-extras-git doxygen)
checkdepends=(xorg-server-xvfb)
source=('git+https://github.com/ubports/unity8.git'
        'https://github.com/ubports/unity8/commit/61e58b78484d182fec0e783b9674a2e2b89eec83.patch'
        'AndroidAway.patch'
        'NoDpkgParse.patch')
sha256sums=('SKIP'
            'SKIP'
            'ba26a1235461f531f9961a306da22593db92d3bd08a84139ef4ae2d042a2b1cc'
            'ef149765d0c8c5f2366d7bab4d7b3084014b57258f759ed41d7c0efd1c75f69e')

BUILDENV+=('!check') # https://paste.ubuntu.com/p/2d33RJX4W8/

pkgver() {
  cd ${_pkgname}
  echo "r$(git rev-list --count HEAD).$(git describe --always)"
}

prepare() {
  cd ${_pkgname}
  git checkout bionic 
  
  patch -Np1 -i "${srcdir}/61e58b78484d182fec0e783b9674a2e2b89eec83.patch"
  patch -Np1 -i "${srcdir}/AndroidAway.patch"
  patch -Np1 -i "${srcdir}/NoDpkgParse.patch"
}

build() {
  cd ${_pkgname}
  mkdir -p build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR="lib/" ..
  make
}

check() {
  cd ${_pkgname}/build
  make ARGS+="--output-on-failure" test
}

package() {
  cd ${_pkgname}/build
  make DESTDIR="${pkgdir}/" install
}
# vim:set ts=2 sw=2 et:
